"""
    create by IAmFiveHigh on 2024/2/23
"""
from typing import Union
from collections import deque

graph: dict[str, Union[list[str], list[str]]] = {
    "you": ["alice", "bob", "claire"],
    "bob": ["anuj", "peggy"],
    "alice": ["peggy"],
    "claire": ["thom", "jonny"],
    "anuj": [],
    "peggy": [],
    "thom": [],
    "jonny": []
}

sellers = ["thom"]


def person_is_seller(person):
    return True if person in sellers else False


def search():
    search_queue = deque()
    search_queue += graph["you"]
    checked_person = []

    while search_queue:
        person = search_queue.popleft()
        if person not in checked_person:
            if person_is_seller(person):
                print(f'{person} is seller')
                return True
            else:
                checked_person.append(person)
                search_queue += graph[person]
    print("dont have seller")


if __name__ == '__main__':
    search()
